import { VxeGridProps } from 'vxe-table';
import { BizPriceVo } from '@/api/operation/price/types';
import { centToYuan, yuanToCent, secToMinu, minuToSec } from '@/utils/index';

export function getTableConfig(): VxeGridProps<BizPriceVo> {
  return {
    id: 'tenant',
    loading: false,
    height: 'auto',
    autoResize: true,
    border: 'inner',

    resizable: true,
    showOverflow: 'tooltip',
    stripe: true,
    rowConfig: {
      isHover: true,
      keyField: 'id'
      // height: 56
    },
    customConfig: {
      storage: true
    },
    columns: [
      { title: '序号', type: 'seq', width: 50 },
      { sortable: true, field: 'accessoryId', title: '定价ID', width: 180 },
      { sortable: true, field: 'name', title: '耗材名称' },
      { sortable: true, field: 'bindPriceType', title: '配置类型', slots: { default: 'type' } },
      { sortable: true, field: 'scope', title: '类型', slots: { default: 'scope' } },
      {
        field: 'content',
        title: '定价（元）',
        formatter: ({ row }) => centToYuan(Number(row.price) || 0)
      },
      { sortable: true, field: 'createByName', title: '创建人' },
      { sortable: true, field: 'createTime', title: '创建时间' },
      { sortable: true, field: 'handle', title: '操作', width: '140px', slots: { default: 'handle' } }
    ],
    data: [] as BizPriceVo[]
  };
}
